< previous page page_136 next page >

Page 136
The rich text box also includes several methods that perform more general word processing functions like searching for text and loading and saving the text together with its formatting information. The following list describes these methods.
Find. Searches the text for a string.
GetLineFromChar. Returns the number of the line containing a specified character position.
LoadFile. Loads the rich text box from a text or RTF format file.
SaveFile. Saves the contents of the rich text box in a text or RTF format file.
SelPrint. Sends the selected text to a printer.
Span. Selects text forward or backward until it finds one of a set of characters. This is useful for selecting words or sentences.
UpTo. Moves the insertion point forward or backward to one of a set of characters. This is useful for moving to a new word or sentence.
The rich text box provides three properties for getting and setting its text value.
Text. Returns or sets the control's text without any formatting.
RTFText. Returns or sets the control's text including rich text formatting codes.
SelRTF. Returns or sets the control's selected text, including rich text formatting codes.
Example program Rich, shown in Figure 4.12, uses these properties to combine text in two rich text boxes. When you click the Combine button, the program copies the Text property from the upper controls into the rich text box on the lower left.
0136-01.jpg
Figure 4.12
Example program Rich shows how to combine formatted text in rich text boxes.

 
< previous page page_136 next page >